from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *

# 关于页面
class AboutPage():

    def __init__(self, ui):
        self.ui = ui

    def create_page(self):
        # 软件介绍页面
        about_widget = QWidget()
        about_layout = QVBoxLayout()
        content_layout = QVBoxLayout()
        foot_layout = QVBoxLayout()

        # 标题标签
        label_title = QLabel('AiSuperTool Free' + self.ui.version)
        label_title.setFont(QFont('楷体', 20))
        label_title.setAlignment(Qt.AlignTop | Qt.AlignCenter)
        # 软件详情标签
        label_detail = QLabel('\u3000\u3000AiSuperTool Free 是一款支持快速训练出模型文件的图形化软件，无需搭建TensorFlow开发环境，一键完成训练模型的操作，帮助您快速实现应用落地。')
        label_detail.setFont(QFont('楷体', 14))
        label_detail.setWordWrap(True)  # 自动换行
        label_detail.setAlignment(Qt.AlignLeft)

        # author
        label_author = QLabel('开发者：冰淇淋的眼泪')
        label_author.setFont(QFont('楷体', 12))
        label_author.setAlignment(Qt.AlignLeft)

        # contact
        label_contact = QLabel('邮箱：3462883374@qq.com 微信：15108065297')
        label_contact.setFont(QFont('楷体', 12))
        label_contact.setAlignment(Qt.AlignLeft)

        img_label = QLabel()
        img_label.setMaximumWidth(333)
        img_label.setMaximumHeight(333)
        img_label.setPixmap(QPixmap('images/me.jpg'))
        img_label.setScaledContents(True)


        # 版权声明
        label_right = QLabel('Copyright © 2022 玫瑰花工作室 All Rights Reserved.')
        label_right.setFont(QFont('楷体', 10))
        label_right.setAlignment(Qt.AlignBottom | Qt.AlignCenter)

        # 添加到布局中
        content_layout.addWidget(label_title)
        content_layout.addWidget(label_detail)
        content_layout.addWidget(label_author)
        content_layout.addWidget(label_contact)

        content_layout.addWidget(img_label)
        foot_layout.addWidget(label_right)

        about_layout.addLayout(content_layout)
        about_layout.addLayout(foot_layout)
        about_widget.setLayout(about_layout)

        return about_widget


